#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
	char arr[100][100] = { 0 };
	int n = 0;
	while (scanf("%d", &n) != EOF)
	{
		const int num = n;
		int i = 0, j = 0;
		for (i = 0; i < num; i++)
		{
			for (j = 0; j < num; j++)
			{
				if ((0 == i) || (num - 1 == i)|| (0 == j) || (num - 1 == j))
				{
					arr[i][j] = '*';
					printf("%c ", arr[i][j]);
				}
				else 
				{
					arr[i][j] = ' ';
					printf("%c ", arr[i][j]);
				}
			}
			printf("\n");
		}
	}
	return 0;
}